package com.demo;

import org.springframework.util.StopWatch;

/**
 * Created by IntelliJ IDEA.
 * User: bj910
 * Date:2023-03-22
 * Time: 16:54
 * To change this template use File | Settings | File Templates.
 */
public class StopWatchDemo {
    public static void main(String[] args) throws InterruptedException {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        int sum = 0;
        for (int i = 0; i < 10000; i++) {
                Thread.sleep(1);
                sum+=i;
        }
        stopWatch.stop();
        System.out.println(stopWatch.prettyPrint());
        System.out.println(stopWatch.getLastTaskTimeMillis());
        System.out.println(stopWatch.getTotalTimeMillis());
    }
}
